﻿<UserControls:ScrumUserControl 
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:UserControls="clr-namespace:ScrumTable.UI.View.WinTouch.UserControls"
	xmlns:Controls="clr-namespace:Microsoft.Surface.Presentation.Controls;assembly=Microsoft.Surface.Presentation"
	xmlns:Command="clr-namespace:ScrumTable.UI.View.Command;assembly=ScrumTable.UI.View"
	xmlns:Converter="clr-namespace:ScrumTable.UI.View.Converter;assembly=ScrumTable.UI.View"
	xmlns:PlanningPoker="clr-namespace:ScrumTable.UI.View.WinTouch.UserControls.PlanningPoker"
	xmlns:Tool="clr-namespace:ScrumTable.UI.View.WinTouch.UserControls.Tool"
	xmlns:Animation="clr-namespace:ScrumTable.UI.View.Animation;assembly=ScrumTable.UI.View"
	xmlns:ShaderEffectLibrary="clr-namespace:ShaderEffectLibrary;assembly=ScrumTable.UI.View"
	xmlns:CustomControl="clr-namespace:ScrumTable.UI.View.CustomControl;assembly=ScrumTable.UI.View"
	xmlns:Localization="clr-namespace:ScrumTable.UI.View.Localization;assembly=ScrumTable.UI.View"
	x:Class="ScrumTable.UI.View.WinTouch.UserControls.PlanningPoker.PlanningPoker"	x:Name="UserControl"    
    HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="Transparent" AllowDrop="True">
    <UserControls:ScrumUserControl.Resources>
        <Storyboard x:Key="StoryboardShowOtherCards">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="ScrumPokerCardsContainer">
                <EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="20" >
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CubicEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="BackgroundScrumPokerCardsContainer">
                <EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CubicEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
        <Storyboard x:Key="StoryboardHideOtherCards">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="ScrumPokerCardsContainer">
                <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="-350">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CubicEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="BackgroundScrumPokerCardsContainer">
                <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="-350">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CubicEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
        
        <Storyboard x:Key="StoryboardQuit">            
            <ThicknessAnimation To="-1000,0,0,0" Storyboard.TargetProperty="Margin" Storyboard.TargetName="Maingrid" BeginTime="0:0:0.0" Duration="0:0:0.8"   >
                <ThicknessAnimation.EasingFunction>
                    <CubicEase EasingMode="EaseOut"/>
                </ThicknessAnimation.EasingFunction>
            </ThicknessAnimation>
            <DoubleAnimation Storyboard.TargetProperty="Opacity" To="0.0" Storyboard.TargetName="Centerbackground" Duration="0:0:0.8"/>
        </Storyboard>


        <Storyboard x:Key="StoryboardLoaded">
         
            <ThicknessAnimation To="0,0,0,0" Storyboard.TargetProperty="Margin" Storyboard.TargetName="Maingrid" BeginTime="0:0:0.0" Duration="0:0:0.8"   >
                <ThicknessAnimation.EasingFunction>
                    <CubicEase EasingMode="EaseOut"/>
                </ThicknessAnimation.EasingFunction>
            </ThicknessAnimation>
            <DoubleAnimation Storyboard.TargetProperty="Opacity" From="0.0" To="0.6" Storyboard.TargetName="Centerbackground" Duration="0:0:0.4"/>                                 
         </Storyboard>
    </UserControls:ScrumUserControl.Resources>
    <Grid>
        <Grid.Resources>
            <Converter:ConverterBoolVisibility x:Key="ConverterBoolVisibility"/>
            <Converter:ConverterNotBoolVisibility x:Key="ConverterNotBoolVisibility"/>
        </Grid.Resources>        
        <Controls:TagVisualizer Name="CardTagVisualizer">
            <Grid>                             
                <Grid.RowDefinitions>
                    <RowDefinition Height="0" x:Name="row0"/>
                    <RowDefinition Height="*"  x:Name="row1"/>
                    <RowDefinition Height="80" x:Name="row2"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" x:Name="column0"/>                    
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>                 
                <UserControl Visibility="Hidden" Name="RootDummy"/>
                <UserControl Background="White" Opacity="0" VerticalAlignment="Stretch"  Grid.Row="0"  Grid.Column="0" Grid.ColumnSpan="3" Grid.RowSpan="3" x:Name="Centerbackground"/>
                
                
                <UserControl HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="1" Grid.Row="0" Grid.RowSpan="3" Background="#181818" x:Name="BackgroundScrumPokerCardsContainer">
                    <UserControl.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform/>
                            <SkewTransform/>
                            <RotateTransform/>
                            <TranslateTransform X="-340"/>
                        </TransformGroup>
                    </UserControl.RenderTransform>
                </UserControl>
                <StackPanel Margin="0,140,20,90" Grid.Column="1" Grid.Row="0" Grid.RowSpan="3" VerticalAlignment="Top"  HorizontalAlignment="Stretch"  x:Name="ScrumPokerCardsContainer" Visibility="Visible">                                        
                    <StackPanel.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform/>
                            <SkewTransform/>
                            <RotateTransform/>
                            <TranslateTransform X="-340"/>
                        </TransformGroup>
                    </StackPanel.RenderTransform>

                    <TextBlock Style="{StaticResource ResourceKey=DescriptionTextBlock}"  FontSize="22" FontWeight="Light" Foreground="White"  HorizontalAlignment="Left" Visibility="{Binding IsSurfaceMode,  ElementName=UserControl, Converter={StaticResource ConverterBoolVisibility}}" Text="{Localization:Translate Uid=ScrumPoker_AverageCardsPlaced, Default=[Average]}" />
                    <UserControls:ScrumPokerCardControl MouseDown="OnAverageClick" TouchDown="OnAverageClick" AllowDrop="True" x:Name="AverageCard" HorizontalAlignment="Left" Margin="0,12,0,0" Visibility="{Binding IsSurfaceMode,  ElementName=UserControl, Converter={StaticResource ConverterBoolVisibility}}" DataContext="{x:Null}" />
                    <TextBlock Margin="0,50,0,0" Style="{StaticResource ResourceKey=DescriptionTextBlock}"  FontSize="22" FontWeight="Light" Foreground="White" HorizontalAlignment="Left" Text="{Localization:Translate Uid=ScrumPoker_Othercards, Default=[Othercards]}" Visibility="{Binding IsSurfaceMode,  ElementName=UserControl, Converter={StaticResource ConverterBoolVisibility}}"/>
                    <TextBlock Margin="0,50,0,0" Style="{StaticResource ResourceKey=DescriptionTextBlock}"  FontSize="22" FontWeight="Light" Foreground="White" HorizontalAlignment="Left" Text="{Localization:Translate Uid=ScrumPoker_SelectCard, Default=[SelectValue]}" Visibility="{Binding IsSurfaceMode,  ElementName=UserControl, Converter={StaticResource ConverterNotBoolVisibility}}"/>
                    <UserControls:SurfaceDragDropListBox  ItemsAreStatic="True" Background="Transparent"  IsItemSelectable="True" Padding="0" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Bottom" CanDrag="False"
                                x:Name="ScrumPokerCards"  BorderThickness="0"  MultipleColumnsRows="True" MultipleColumnsRowsSize="100,50" Height="500" Width="300" 
                                AllowDrop="False"  Orientation="Vertical" Margin="-3,5,0,0" EffectColor="White" SelectionChanged="OnSelectionChanged"
                                ItemsSource="{Binding Path=AllCards, ElementName=UserControl}"            
                                ScrollViewer.VerticalScrollBarVisibility="Hidden">
                        <UserControls:SurfaceDragDropListBox.ItemTemplate>
                            <DataTemplate>
                                <UserControls:ScrumPokerCardControl DataContext="{Binding}" AllowDrop="True"/>
                            </DataTemplate>
                        </UserControls:SurfaceDragDropListBox.ItemTemplate>
                        <UserControls:SurfaceDragDropListBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <CustomControl:VirtualizingMultiLinePanel ShowContentCenter="False" Orientation="Vertical" />
                            </ItemsPanelTemplate>
                        </UserControls:SurfaceDragDropListBox.ItemsPanel>
                    </UserControls:SurfaceDragDropListBox>
                </StackPanel>

                <Grid Grid.Row="0" Grid.RowSpan="3" Grid.ColumnSpan="1" Name="Maingrid"  >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>                        
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>

                    <UserControl Background="#111111"/>
                    <UserControl Background="#111111" Grid.ColumnSpan="2"/>
                    <Grid HorizontalAlignment="Left" VerticalAlignment="Stretch" Width="75" Grid.Column="0" Margin="10,60,10,100">
                        <Grid.Resources>
                            <Style BasedOn="{StaticResource StyleFeedbackButton}" TargetType="{x:Type Tool:ToolButton}" x:Key="BlackToolButton">
                                <Setter Property="Foreground" Value="Black"/>
                                <Setter Property="Margin" Value="0,0,0,40"/>
                                <Setter Property="Effect" >
                                    <Setter.Value>
                                        <ShaderEffectLibrary:InvertColorEffect/>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </Grid.Resources>
                        <StackPanel VerticalAlignment="Top">
                            <Tool:ToolButton VerticalAlignment="Top" Style="{StaticResource BlackToolButton}" ContentBackground="{StaticResource W8IconBack}" ContentText="{Localization:Translate Uid=ScrumPoker_Back, Default=[Back]}"  Click="OnClose" />
                            <Tool:ToolButton x:Name="ExposeButton" Style="{StaticResource BlackToolButton}"  ContentBackground="{StaticResource W8IconExposeCard}" ContentText="{Localization:Translate Uid=ScrumPoker_Reveal, Default=[Reveal]}"  Click="OnExpose" Visibility="{Binding IsSurfaceMode,  ElementName=UserControl, Converter={StaticResource ConverterBoolVisibility}}" IsEnabled="False" />
                            <Tool:ToolButton x:Name="ReplayButton" Style="{StaticResource BlackToolButton}" ContentBackground="{StaticResource W8IconReplay}" ContentText="{Localization:Translate Uid=ScrumPoker_Replay, Default=[Replay]}"  Click="OnReplay" Visibility="{Binding IsSurfaceMode,  ElementName=UserControl, Converter={StaticResource ConverterBoolVisibility}}" />                         
                        </StackPanel>                  
                    </Grid>

                    <StackPanel Orientation="Vertical" Grid.Column="1"   HorizontalAlignment="Left" VerticalAlignment="Top"  Margin="20,50,20,100" Visibility="{Binding IsSurfaceMode,  ElementName=UserControl, Converter={StaticResource ConverterBoolVisibility}}"  >
                        <TextBlock Style="{StaticResource ResourceKey=TitleTextBlock}" FontSize="44" FontWeight="Light" Height="60" Text="{Localization:Translate Uid=ScrumPoker_Title, Default=[Title]}" Foreground="White" Margin="0,0,0,0"/>
                        <TextBlock Style="{StaticResource ResourceKey=DescriptionTextBlock}" FontSize="22" FontWeight="Light" Foreground="White" 
                                   TextWrapping="Wrap" TextAlignment="Left" 
                                   Text="{Localization:Translate Uid=ScrumPoker_Placed, Default=[PlacedCards]}" Margin="0,30,0,0"></TextBlock>

                        <UserControls:SurfaceDragDropListBox Orientation="Vertical" MultipleColumnsRows="True" x:Name="ScrumPokerCardsListBox" ItemsAreStatic="True" IsItemSelectable="False"  BorderBrush="{x:Null}" Width="420"
                                                    Padding="0" HorizontalAlignment="Stretch" Margin="-3,10,0,0" CanDrag="False"
                                                    ItemsSource="{Binding PlacedCards,  ElementName=UserControl}" HorizontalContentAlignment="Left" Background="{x:Null}"                             
                                                    SelectionChanged="OnPlayedCardListClicked"  ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden">
                            <UserControls:SurfaceDragDropListBox.ItemTemplate>
                                <DataTemplate>
                                    <Grid Margin="0,0,7,7">
                                        <Border BorderBrush="Transparent" BorderThickness="1" CornerRadius="2" >
                                            <PlanningPoker:ScrumPlanningPokerCardControl DataContext="{Binding}"/>
                                        </Border>
                                        <Border BorderBrush="White" BorderThickness="1" CornerRadius="2" Opacity="0.23"/>
                                    </Grid>
                                </DataTemplate>
                            </UserControls:SurfaceDragDropListBox.ItemTemplate>
                            <UserControls:SurfaceDragDropListBox.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <CustomControl:VirtualizingMultiLinePanel ShowContentCenter="False" Orientation="Vertical" />
                                </ItemsPanelTemplate>
                            </UserControls:SurfaceDragDropListBox.ItemsPanel>
                        </UserControls:SurfaceDragDropListBox>

                    </StackPanel>
                </Grid>
            </Grid>
        </Controls:TagVisualizer>
    </Grid>  
</UserControls:ScrumUserControl>    